var baseUrl ="http://news.zrart.net.cn/"; //请求的根地址
var baseNews = "http://news.zrart.net.cn/news";
function getUrlParam(name) {
    var reg = new RegExp("(^|&)" + name + "=([^&]*)(&|$)"); //构造一个含有目标参数的正则表达式对象
    var r = window.location.search.substr(1).match(reg);  //匹配目标参数
    if (r != null) return unescape(r[2]); return null; //返回参数值
}
var cookieUtil = {
    // 设置cookie
    setItem: function (name, value, Days) {
        var exp = new Date();
        exp.setTime(exp.getTime() + Days * 24 * 60 * 60 * 1000);
        document.cookie = name + "=" + escape(value) + ";expires=" + exp.toGMTString();
    },
    // 获取cookie
    getItem: function (name) {
        var arr, reg = new RegExp("(^| )" + name + "=([^;]*)(;|$)"); //正则匹配
        if (arr = document.cookie.match(reg)) {
            return unescape(arr[2]);
        }
        else {
            return null;
        }
        // //return "da99ea3014744b5e9a0a0d964df31fcd";
    },

    // 删除cookie
    removeItem: function (name) {
        this.setItem(name, '1', -1);
    },

    // 检查是否含有某cookie
    hasItem: function (name) {
        return (new RegExp("(?:^|;\\s*)" + encodeURIComponent(name).replace(/[\-\.\+\*]/g, "\\$&") + "\\s*\\=")).test(document.cookie);
    },

    // 获取全部的cookie列表
    getAllItems: function () {
        var cookieArr = document.cookie.replace(/((?:^|\s*;)[^\=]+)(?=;|$)|^\s*|\s*(?:\=[^;]*)?(?:\1|$)/g, "").split(/\s*(?:\=[^;]*)?;\s*/);
        for (var nIdx = 0; nIdx < cookieArr.length; nIdx++) { cookieArr[nIdx] = decodeURIComponent(cookieArr[nIdx]); }
        return cookieArr;
    }
};
//遮罩层
function diaLog(msg) {
    $("body .diaLog").remove();
    var html = `<div class="diaLog">${msg}</div>`;
    $("body").append(html);
    setTimeout(() => {
        $("body .diaLog").fadeOut()
    }, 1500);
    setTimeout(() => {
        $("body .diaLog").remove()
    }, 2000);
}

